package org.yxj.lib_downfile.m;

import android.content.Context;
import org.yxj.lib_downfile.dao.DownFileDao;
import org.yxj.lib_downfile.db.AppSQLiteHelper;

/**
 * @author on 2022/8/25
 */
public class AppSQLiteManager {


    private static AppSQLiteManager manager ;

    /**
     * 数据库操作类
     */
    private AppSQLiteHelper helper ;


    private AppSQLiteManager(){

    }


    public static AppSQLiteManager getInstance() {
        if (null == manager){
            synchronized (AppSQLiteManager.class){
                if (null == manager){
                    manager = new AppSQLiteManager();
                }
            }
        }
        return manager ;
    }


    private Context context ;
    /**
     * 初始化数据库
     * @param context
     */
    public void init(Context context){
        this.context=context;
        helper = new AppSQLiteHelper(context);
    }

    /**
     * 数据库操作对象
     * @return
     */
    public AppSQLiteHelper getHelper() {
        return helper;
    }

    /**
     * 获取下载文件操作刀
     *
     * @return
     */
    public DownFileDao getDownFileDao(){
        return new DownFileDao(context);
    }
}
